using System;
using System.Collections.Generic;
using System.Text;

using Athena.Plugins;

namespace Athena.Core
{
    [Serializable()]
    public class Promoter : Part
    {
        
        public override void GenerateDrawable(System.Drawing.PointF point)
        {
            Drawable = new Objects.PromoterGlyph(point);
            ((Objects.PartGlyph)_Drawable).GenerateModifiers();
        }

        public Promoter(string id, string sequence)
            : base("promoter", id, sequence)
        {
            InputConnectionsAllowed = true;
            OutputConnectionsAllowed = false;
            _AllowPoPSFlow = false;
        }
        public Promoter()
            : base("promoter", "Promoter" + Part.COUNT, "TATAATTGAATCA")
        {
            InputConnectionsAllowed = true;
            OutputConnectionsAllowed = false;
            _AllowPoPSFlow = false;
        }
        public override object Clone()
        {
            return new Promoter(this);
        }

        public Promoter(Promoter copy)
            : base(copy)
        {
            InputConnectionsAllowed = true;
            OutputConnectionsAllowed = false;
            _AllowPoPSFlow = false;
        }

        public override Part.Orientation Direction
        {
            get
            {
                return base.Direction;
            }
            set
            {
                if (_Direction != value)
                {
                    base.Direction = value;

                    Edge.AUTO_MODIFIERS = false;
                    if (value == Orientation.forward)
                    {
                        if (_PoPS_Left == null) _PoPS_Left = new PoPSRate(this);
                        _PoPS_Right = new PoPSRate(this, _PoPS_Left.Rate);
                        _PoPS_Right.CopyModifiers(_PoPS_Left);
                        if (_Right != null)
                            PoPS_Left = _Right.PoPS_Left;
                        else
                            PoPS_Left = new PoPSRate(this);
                        //PoPS_Right = new PoPSRate(this);
                        PoPS_Right = _PoPS_Right;
                        _PoPS_Right.ParentPart = this;
                    }
                    else
                    {
                        if (_PoPS_Right == null) _PoPS_Right = new PoPSRate(this);
                        _PoPS_Left = new PoPSRate(this, _PoPS_Right.Rate);
                        _PoPS_Left.CopyModifiers(_PoPS_Right);
                        if (_Left != null)
                            PoPS_Right = _Left.PoPS_Right;
                        else
                            PoPS_Right = new PoPSRate(this);
                        //PoPS_Left = new PoPSRate(this);
                        PoPS_Left = _PoPS_Left;
                        _PoPS_Left.ParentPart = this;
                    }
                    Edge.AUTO_MODIFIERS = true;
                }
            }
        }

    }
}
